﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for ProteusPartners
/// </summary>
public class ProteusPartners
{
	public bool AreTheyProteusPartners(string email)
	{
        bool Proteus = false;

        int intemail = email.IndexOf("@");

        string strEmail = email.Substring(intemail + 1);

		String dbConn = ConfigurationManager.ConnectionStrings["WDPAConnectionString1"].ConnectionString;
        System.Data.SqlClient.SqlDataReader GetEmail;
        System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection(dbConn);
        sqlConn.Open();

        string selectcommand = "SELECT DISTINCT ProteusEmail FROM [ProteusPartnerEmails] WHERE ([ProteusEmail] = '" + strEmail + "')";
        System.Data.SqlClient.SqlCommand EmailCommand = new System.Data.SqlClient.SqlCommand(selectcommand, sqlConn);

        GetEmail = EmailCommand.ExecuteReader(CommandBehavior.CloseConnection);

        if (GetEmail.HasRows)
        {            
            Proteus = true;              
        }

        return Proteus;       
	}
}
